package com.cloudlead.shipownerAction.action;

import com.cloudlead.common.lang.annotation.Label;
import com.cloudlead.common.lang.persistence.EasyuiGridData;
import com.cloudlead.common.worker.action.impl.AbstractActionFactory;
import com.cloudlead.common.worker.annotation.Action;
import com.cloudlead.common.worker.annotation.Order;
import com.cloudlead.shipownerAction.BusinessModules;
import com.cloudlead.shipownerAction.service.BaseShipEditSer;
import com.cloudlead.shipownerService.BaseShipEditService;
import com.cloudlead.shipownerService.vo.BaseShipVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * Created by 20150817 on 2015/9/2.
 */
@Controller
public class BaseShipEditActionFactory extends AbstractActionFactory implements BaseShipEditService{

    @Autowired//必须要的
    BaseShipEditSer baseShipEditSer;

    public BaseShipEditActionFactory() {
        super(BusinessModules.BaseShipChange);
    }

    @Action
    @Order(1)
    @Label("船舶创建")
    @Override
    public void createShip(@Label("基本信息")BaseShipVo vo) {
        baseShipEditSer.createShip(vo);
    }

    @Action
    @Order(2)
    @Label("编辑船舶")
    @Override
    public void editShip(@Label("基本信息")BaseShipVo vo) {
        baseShipEditSer.editShip(vo);
    }

    @Action
    @Order(3)
    @Label("单值查询")
    @Override
    public Object findOneShip(@Label("基本信息")BaseShipVo vo) {
        return baseShipEditSer.findOneShip(vo);
    }

    @Action
    @Order(4)
    @Label("分页查询")
    @Override
    public EasyuiGridData findAllShip(@Label("基本信息")BaseShipVo vo, @Label("页数")int page, @Label("显示条数")int rows) {
        return new EasyuiGridData(baseShipEditSer.findAllShip(vo,page,rows));
    }

    @Action
    @Order(5)
    @Label("删除船舶")
    @Override
    public void delShip(@Label("船舶ID")String id) {
        baseShipEditSer.delShip(id);
    }
}
